Skip to content

Support dynamic guest identity (UID/GID) configuration via environment variables#109

Open
doanbaotrung wants to merge 1 commit into
sysprog21:mainfrom
open-sources-port:feature/dynamic_uid_gid
Open

Support dynamic guest identity (UID/GID) configuration via environment variables#109
doanbaotrung wants to merge 1 commit into
sysprog21:mainfrom
open-sources-port:feature/dynamic_uid_gid

Conversation

@doanbaotrung

@doanbaotrung doanbaotrung commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Allow users to dynamically configure the simulated guest
UID and GID at runtime via environment variables, for
example: ELFUSE_GUEST_UID and ELFUSE_GUEST_GID.

If these variables are present in the host process
environment, elfuse should parse them and override
the default guest UID/GID.

Fixes #103


Summary by cubic

Add runtime overrides for the simulated guest UID/GID via ELFUSE_GUEST_UID and ELFUSE_GUEST_GID. The values propagate to auxv and procfs so programs see the correct identity.

  • New Features
    • Parse env vars in proc_identity_init() with strict uint32 parsing; ignore invalid/empty/out‑of‑range; fall back to GUEST_UID/GUEST_GID when unset.
    • Auxv AT_UID/AT_EUID/AT_GID/AT_EGID and /proc/self/{status,task/*/status} now use proc_get_* so real/effective/saved‑set and fs IDs reflect overrides.
    • Added test-identity-override-host; built and run by make check.

Written for commit da2339d. Summary will update on new commits.

Review in cubic

@doanbaotrung doanbaotrung force-pushed the feature/dynamic_uid_gid branch from af6f40e to 8a7c0d3 Compare June 23, 2026 07:54
@doanbaotrung doanbaotrung requested a review from jserv June 23, 2026 07:54
cubic-dev-ai[bot]

This comment was marked as resolved.

@doanbaotrung doanbaotrung force-pushed the feature/dynamic_uid_gid branch from 8a7c0d3 to a9f59ab Compare June 23, 2026 08:01
Comment thread src/syscall/proc-identity.c Outdated
@doanbaotrung doanbaotrung force-pushed the feature/dynamic_uid_gid branch from a9f59ab to 14d00bf Compare June 24, 2026 01:22
@doanbaotrung doanbaotrung requested a review from jserv June 24, 2026 03:28
jserv

This comment was marked as resolved.

@doanbaotrung doanbaotrung force-pushed the feature/dynamic_uid_gid branch from 14d00bf to d8fb6c2 Compare June 24, 2026 15:47
environment variables

Allow users to dynamically configure the simulated guest
UID and GID at runtime via environment variables, for
example: ELFUSE_GUEST_UID and ELFUSE_GUEST_GID.

If these variables are present in the host process
environment, elfuse should parse them and override
the default guest UID/GID.
@doanbaotrung doanbaotrung force-pushed the feature/dynamic_uid_gid branch from d8fb6c2 to da2339d Compare June 24, 2026 15:54
@doanbaotrung

This comment was marked as resolved.

@doanbaotrung doanbaotrung requested a review from jserv June 24, 2026 16:01
@jserv

jserv commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

I am not sure whether getenv is an appropriate mechanism for specifying the desired UID/GID. Instead, I am considering adopting the same approach as akeroot.

I defer to @Max042004 for confirmation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support dynamic guest identity (UID/GID) configuration via environment variables

2 participants